//
//  Note.m
//  MyNotes
//
//  Created by chen on 17/3/15.
//  Copyright © 2017年 chen. All rights reserved.
//

#import "Note.h"

@implementation Note
-(instancetype)init{
    self = [super init];
    if (self) {
        self.date = [[NSDate alloc]init];
        self.content = @"";
    }
    return self;
}
-(instancetype)initWithDate:(NSDate *)date content:(NSString *)content{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    self = [super init];
    if (self) {
        self.date = date;
        self.content = content;
        self.dateString = [dateFormatter stringFromDate:date];
    }
    return self;
}
-(instancetype)initWithContent:(NSString *)content andTid:(NSInteger)tid{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    self = [super init];
    if (self) {
        self.date = [[NSDate alloc]init];
        self.content = content;
        self.tid = tid;
        self.dateString = [dateFormatter stringFromDate:_date];
    }
    return self;
}
-(instancetype)initWithContent:(NSString *)content andTid:(NSInteger)tid andDate:(NSString *)date{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    self = [super init];
    if (self) {
        self.content = content;
        self.tid = tid;
        self.date = [dateFormatter dateFromString:date];
        self.dateString = date;
    }
    return self;
}

@end
